import $axios from "@/network";

/**
 * 查询服务列表
 * @returns {*}
 */
export const queryServiceList = (current, size, servType) => {
  return $axios({
    method: 'POST',
    url: '/data/dataService/query/list',
    data: {
      "current": current,
      "size": size,
      "servType": servType,
    }
  })
}
/**
 * 创建服务
 * @returns {*}
 */
export const createdService = (param) => {
  return $axios({
    method: 'POST',
    url: '/data/dataService/save',
    data: param,
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}

  })
}
/**
 * 根据id查询服务
 * @returns {*}
 */
export const queryServiceById = (id) => {
  return $axios({
    method: 'GET',
    url: '/data/dataService/query',
    params: {
      "servId": id,
    }
  })
}
/**
 * 修改服务
 * @returns {*}
 */
export const updatedService = (param) => {
  return $axios({
    method: 'POST',
    url: '/data/dataService/edit',
    data: param,
    headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'}

  })
}
/**
 * 删除服务
 * @returns {*}
 */
export const deleteService = (id) => {
  return $axios({
    method: 'GET',
    url: '/data/dataService/delete',
    params: {
      "servId": id,
    }
  })
}
/**
 * 开启/关闭服务
 * @returns {*}
 */
export const updateServiceState = (id, serStatus) => {
  return $axios({
    method: 'POST',
    url: '/data/dataService/updateState',
    params: {
      "servId": id,
      "servState": serStatus,
    }
  })
}
/**
 * 条件查询
 * @returns {*}
 */
export const queryServiceListByCondition = (current, size, servType, form) => {
  return $axios({
    method: 'POST',
    url: '/data/dataService/query/condition',
    data: {
      "current": current,
      "size": size,
      "servType": servType,
      "servName": form.servName,
      "servDate": form.servDate + "",
    }
  })
}